package com.shntec.xtask.dao;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.HashMap;

import com.shntec.bp.common.BaseSQLHelper;
import com.shntec.bp.common.ShntecBaseDAO;
import com.shntec.bp.util.ShntecLogger;

public class XtaskMeetingsObject extends ShntecBaseDAO{
	
	private final static String THIS_TABLE_NAME = "xtask_meetings";
	private final static String THIS_PRIMARY_KEY_NAME = "mid";
	
	private Integer mid = null;
	private Integer aid = null;
	private Integer pid = null;
	private Integer did = null;
	private String todayComplete = null;
	private String todayPlan = null;
		
	public XtaskMeetingsObject(BaseSQLHelper helper){
		super(helper);
		tableName = THIS_TABLE_NAME;
		primaryKeyName = THIS_PRIMARY_KEY_NAME;
	}

	public Integer getDid() {
		return did;
	}

	public void setDid(Integer did) {
		this.did = did;
	}

	public Integer getMid() {
		return mid;
	}

	public void setMid(Integer mid) {
		this.mid = mid;
	}

	public Integer getAid() {
		return aid;
	}

	public void setAid(Integer aid) {
		this.aid = aid;
	}

	public Integer getPid() {
		return pid;
	}

	public void setPid(Integer pid) {
		this.pid = pid;
	}

	public String getTodayComplete() {
		return todayComplete;
	}

	public void setTodayComplete(String todayComplete) {
		this.todayComplete = todayComplete;
	}

	public String getTodayPlan() {
		return todayPlan;
	}

	public void setTodayPlan(String todayPlan) {
		this.todayPlan = todayPlan;
	}

	@Override
	protected boolean loadResultSet(ResultSet rs) {
		try {
			mid = rs.getInt("mid");
			aid = rs.getInt("aid");
			pid = rs.getInt("pid");
			todayComplete = rs.getString("todayComplete");
			todayPlan = rs.getString("todayPlan");
			did = rs.getInt("did");
		} catch (SQLException e) {
			ShntecLogger.logger.error("Handle database resultset failed, table name=" + getTableName());
			ShntecLogger.logger.error(e.getMessage());
			return false;
		}
		
		return true;
	}

	@Override
	protected HashMap<String, Object> generateColumnList() {
		HashMap<String, Object> columnList = new HashMap<String, Object>();
		
		columnList.put("mid", mid);
		columnList.put("aid", aid);
		columnList.put("pid", pid);
		columnList.put("todayComplete", todayComplete);
		columnList.put("todayPlan", todayPlan);
		columnList.put("did", did);
		
		return columnList;
	}

	@Override
	protected void updateResultSet(ResultSet rs) throws SQLException {
		
		updateAllowNullColumns(rs, "aid", aid);
		
		updateAllowNullColumns(rs, "pid", pid);
		
		updateNotAllowNullColumns(rs, "todayComplete", todayComplete);
		
		updateNotAllowNullColumns(rs, "todayPlan", todayPlan);
		
		updateAllowNullColumns(rs, "did", did);
		
	}
	
	
}
